<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="">
        <input type="text" name="hong">
        <input type="password" name="123">
        <button>提交按钮</button>
    </form>
    <a href="#123">哈希</a>
    <a href="#456">#哈希</a>
    <button class="shua">刷新按钮</button>
    <script>
        //location返回对象 页面的url信息
        console.log(window.location);
        //href 页面地址
        console.log(location.href);
        // location.href = '//www.baidu.com';
        const but = document.querySelector('button');
        console.log(but);
        //获取地址中携带的参数 ？后面的
        console.log(location.search);
        console.log(location.hash);
        const as = document.querySelector('a');
        as.addEventListener('click', function () {
            //hash哈希 返回#后面的值
            console.log(location.hash);

        })
        const but1 = document.querySelector('.shua');
        console.log(but1);
        but1.addEventListener('click', function () {
            //reload()刷新页面 true为强制刷新
            console.log(location.reload(true));

        })

    </script>
</body>

</html>